package com.cyx.mapper;

import com.cyx.pojo.Clazz;
import com.cyx.pojo.ClazzQueryParam;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClazzMapper {
    /**
     * 条件分页查询班级信息
     */
    List<Clazz> list(ClazzQueryParam clazzQueryParam);

    /**
     * 根据班级 ID 删除班级信息
     */
    @Delete("delete from clazz where id = #{id}")
    void deleteClazzById(Integer id);

    /**
     * 添加班级信息
     */
    @Insert("insert into clazz(name, room, begin_date, end_date, master_id, subject,create_time,update_time)" +
            "values (#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void add(Clazz clazz);


    /**
     * 根据班级 ID 查询班级信息
     */
    Clazz getInfoById(Integer id);

    /**
     * 修改班级信息
     */
    void updateById(Clazz clazz);

    /**
     *  查询所有班级信息
     */
    @Select("select id, name, room, begin_date, end_date, master_id, subject, create_time, update_time from clazz")
    List<Clazz> findAll();
}
